{include file="common/_meta" /}
<title>代理申请</title>
</head>

<body>
    <nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span>代理管理 <span class="c-gray en">&gt;</span> 代理申请 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a></nav>
    <div class="page-container">
        <div class="text-c">
            <form class="Huiform" method="get" action="">
                代理类型
                <span class="select-box inline">
                <select name="dltype" class="select">
                    <option value="">全部</option> 
                    <option value="1">市级代理</option> 
                    <option value="2">区域代理</option>
                </select>
                </span>
                所在省市：
                <span class="select-box inline">
                <select name="province" class="select">
                    <option value="">--全部--</option>
                    {volist name="province" id='vo'}
                        <option value="{$vo.p_code}">{$vo.name}</option>
                    {/volist}
                </select>
                </span>
                <input type="text" class="input-text" style="width:250px" placeholder="代理姓名、手机号" id="" name="keywords" value="{$Request.get.keywords|default=''}">
                <button type="submit" class="btn btn-success radius" id="" name=""><i class="Hui-iconfont">&#xe665;</i> 搜索</button>
            </form>
        </div>
        <div class="cl pd-5 bg-1 bk-gray mt-20">
            <span class="r">共有数据：<strong>{$list->total()}</strong> 条</span></div>
        <div class="mt-20">
            <table class="table table-border  table-hover table-bg table-sort">
                <thead>
                    <tr class="text-c">
                        <th width="25">
                            <input type="checkbox" name="" value="">
                        </th>
                        <th>编号</th>
                        <th>申请人</th>
                        <th>申请类型</th>
                        <th>代理区域</th>
                        <th>申请时间</th>
                        <th>状态</th>
                        <th width="10%">操&nbsp;&nbsp;&nbsp;&nbsp;作</th>
                    </tr>
                </thead>
                <tbody>
                    {volist name='list' id="vo"}
                    <tr class="text-c">
                        <td>
                            <input type="checkbox" value="1" name="">
                        </td>
                        <td>{$i}</td>
                        <td>{$vo.name}:{$vo.tel}</td>
                        <td>{if condition="$vo['dltype'] eq 1"} 市级代理 {else/} 区域代理 {/if}</td>
                        <td>{$vo.mer_name}</td>
                        <td>{$vo.create_time}</td>
                        <td class="td-status">
                            待审核
                        </td>
                        <td class="td-manage">
                            <a style="text-decoration:none" onClick="opt(this,{$vo.id},1)" href="javascript:;" title="审核通过"><i class="Hui-iconfont">&#xe6a7;</i></a> &nbsp;&nbsp;&nbsp;
                            <a style="text-decoration:none" onClick="cancle(this,{$vo.id},-1)" href="javascript:;" title="驳回申请"><i class="Hui-iconfont">&#xe6a6;</i></a>
                        </td>
                    </tr>
                    {/volist}
                </tbody>
            </table>
            <div class="pages" style="margin:20px;float: right; ">{$list->render()}</div>
        </div>
    </div>
    {include file="common/_footer" /}
    <!--请在下方写此页面业务相关的脚本-->
    <script>
    // 操作申请
    function opt(obj, id, status) {
        $.post("{:url('applyList')}", { id: id, status: status }, function(data) {
            layer.msg(data.msg);
            if (data.code) {
                setTimeout(function() {
                    history.go(0);
                }, 500);
            }
        });
    }

    // 驳回申请
    function cancle(obj, id, status) {
        layer.prompt({
                formType: 2,
                title: '驳回申请，填写理由'
            },
            function(val, index) {
                var note = val;

                $.post("{:url('applyList')}", { id: id, status: status, note: note }, function(data) {
                    layer.msg(data.msg);
                    if (data.code) {
                        setTimeout(function() {
                            history.go(0);
                        }, 500);
                    }

                });
            });
    }
    </script>
</body>

</html>